package cn.limc.ohoscharts.demo.slice;

import cn.limc.ohoscharts.demo.ResourceTable;
import cn.limc.ohoscharts.entity.TitleValueColorEntity;
import cn.limc.ohoscharts.view.DonutChart;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;

import java.util.ArrayList;
import java.util.List;

public class DonutChartAbility extends AbilitySlice {

  DonutChart donutchart;

  @Override
  public void onStart(Intent intent) {
    super.onStart(intent);
    super.setUIContent(ResourceTable.Layout_ability_donut_chart);
    initDonutChart();
  }

  private void initDonutChart() {
    this.donutchart = (DonutChart) findComponentById(ResourceTable.Id_donutchart);
    List<TitleValueColorEntity> data3 = new ArrayList<TitleValueColorEntity>();
    data3.add(new TitleValueColorEntity("Alpha",
            800, 0xFFFF0000));
    data3.add(new TitleValueColorEntity("Bravo",
            900, 0xFFFF8D00));
    data3.add(new TitleValueColorEntity("Charlie",
            200, 0xFFFFFF00));
    data3.add(new TitleValueColorEntity("Delta",
            400, 0xFF96FF00));
    data3.add(new TitleValueColorEntity("Echo",
            700, 0xFF00FF00));
    donutchart.setData(data3);
  }
}
